package com.zhiche.lisa.lspm.controller;

import com.zhiche.lisa.core.enums.CommonEnum;
import com.zhiche.lisa.core.supports.BaseException;
import com.zhiche.lisa.core.supports.RestfulResponse;
import com.zhiche.lisa.lspm.vo.attach.LicencePictureVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by zhaoguixin on 2018/7/16.
 */
@RestController
@RequestMapping(value = "/licencePicture")
@Api(value = "/licencePicture", description = "证照照片",tags={"证照照片接口"})
public class LicencePictureController {

    private static final Logger LOGGER = LoggerFactory.getLogger(LicencePictureController.class);

    @PostMapping(value = "/save")
    @ApiOperation(value = "保存照片", notes = "保存照片", produces = MediaType.APPLICATION_JSON_VALUE,response =
            RestfulResponse.class)
    public RestfulResponse save(@RequestBody LicencePictureVO licencePictureVO){
        LOGGER.info("LicencePictureController.save param: {}", licencePictureVO);
        RestfulResponse result = new RestfulResponse<>(CommonEnum.SUCCESS.getCode(),"success",null);
        try{

        }catch(BaseException be){
            LOGGER.error("VehicleController.verifyTrailer error:{}",be.getMessage());
            result.setMessage(be.getMessage());
            result.setCode(CommonEnum.ERROR.getCode());
        }catch(Exception e){
            LOGGER.error("VehicleController.verifyTrailer error:{}",e.getMessage());
            result.setMessage("取消绑定失败,系统异常");
            result.setCode(CommonEnum.ERROR.getCode());
        }
        return result;
    }
}
